package com.xunjing.order.config;

import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author ZYT
 * @Date 2024-03-29 12:07
 * @Version 1.0
 * @Describe mvc配置
 */
@Configuration
public class SpringMvcConfiguration {
    /**
     * json自定义序列化工具,long转string
     *
     * @author zhangyt
     * @date 2021-12-29 10:33:02
     */
    @Bean
    public Jackson2ObjectMapperBuilderCustomizer jackson2ObjectMapperBuilderCustomizer() {
        return jacksonObjectMapperBuilder -> jacksonObjectMapperBuilder.serializerByType(Long.class, ToStringSerializer.instance).serializerByType(Long.TYPE, ToStringSerializer.instance);
    }
}
